//
//  PTSButtonViewController.m
//  aTest
//
//  Created by mac on 15/11/6.
//  Copyright © 2015年 黄杰. All rights reserved.
//

#import "PTSButtonViewController.h"

@interface PTSButtonViewController ()
@property (weak, nonatomic) IBOutlet PTSButton *PTSButton;
@property (weak, nonatomic) IBOutlet PTSButton *testButton;
@property (weak, nonatomic) IBOutlet PTSChangeButton *testButton1;
@property (weak, nonatomic) IBOutlet PTSChangeButton *testButton2;
@end

@implementation PTSButtonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.PTSButton.animationSwitch = NO;
    
    self.testButton1.changeImageAndTitle = ImgTTitleB;
    self.testButton2.changeImageAndTitle = ImgBTitleT;
}

- (IBAction)PTSButtonClick:(PTSButton *)sender {
    
    [self setupNetData];
    
}

- (void)setupNetData{
    
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    param[@"access_token"] = @"0f96f631be8f64b7ed4c82e53dd41b9c";
    param[@"page"] = @(1);
    param[@"size"] = @"12";
    
    NSString *url = @"http://news.pts80.net/jyb/api/?action=message&control=message_list";
    
    [self.PTSButton startLoading];
    
    [PTSManageTool PostWithURL:url parameters:param success:^(id json) {
        
        [self.PTSButton stopLoading];
        
    } failure:^(PTSError *error) {
        
        [self.PTSButton stopLoading];
        
        NSLog(@"%@", error.errorString);
    }];
    
}


@end
